<template>
	<div class="dashboard-container">
	  <div class="item">
		<h1>学校总数</h1>
		<h1>{{schoolC}}</h1>
	  </div>
	  <div class="item">
		<h1>学院总数</h1>
		<h1>{{academyC}}</h1>
	  </div>
	  <div class="item">
		<h1>班级总数</h1>
		<h1>{{classC}}</h1>
	  </div>
	  <div class="item">
		<h1>学生总数</h1>
		<h1>{{studentC}}</h1>
	  </div>
	  <div class="item">
		<h1>老师总数</h1>
		<h1>{{teacherC}}</h1>
	  </div>
	</div>
</template>

<script>
  import { mapGetters } from 'vuex'

  export default {
    name: 'Dashboard',
    computed: {
      ...mapGetters([
        'name'
      ])
    },
	data(){
		return{
			schools:{},
			schoolC:0,
			academies:{},
			academyC:0,
			classes:{},
			classC:0,
			students:{},
			studentC:0,
			teachers:{},
			teacherC:0
		}		
	},
    mounted(){
      this.$http.get('/api/users/add').then(res => {
        console.log('this.panels', res)
      })
	  this.$http.post('/api/school/get').then(res => {
		this.schools = res;
		this.schoolC = this.schools.length;
		console.log(this.schoolC);
		})
	  this.$http.post('/api/academy/get').then(res => {
		this.academies = res;
		this.academyC = this.academies.length;
		console.log(this.academyC);
		})
	  this.$http.post('/api/classs/get').then(res => {
		this.classes = res;
		this.classC = this.classes.length;
		console.log(this.classC);
		})
	  this.$http.post('/api/student/get').then(res => {
		this.students = res;
		this.studentC = this.students.length;
		console.log(this.studentC);
		})
	  this.$http.post('/api/teacher/get').then(res => {
		this.teachers = res;
		this.teacherC = this.teachers.length;
		console.log(this.teacherC);
		})
    }
  }
</script>

<style lang="scss" scoped>
  .dashboard {
    &-container {
      margin: 30px;
	  display: flex;
	  justify-content:space-around;
    }
    &-text {
      font-size: 30px;
      line-height: 46px;
    }
  }
  h1 {
		text-align:center;
	}
</style>